# Importing Data
UAE<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "AL1:AL239")

# Checking the Imported Data
View(UAE)
# Creating Time Series Data
UAE_ts <- ts(UAE, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
UAE_ts
sum(is.na(UAE_ts))
library(forecast)
UAE_ts <- tsclean(UAE_ts)
UAE_ts

# Identification: Plotting the Time Series Data
plot(UAE_ts)

# Estimating the appropriate model
UAE_ts_model <- auto.arima(UAE_ts)
UAE_ts_model

# Forecasting
options(max.print=1000000)
UAE_ts_forecast <- forecast (UAE_ts_model, level=c(95), h=255)
plot(UAE_ts_forecast)
UAE_ts_forecast             

# Exporting
write.table(UAE_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/UAE_TSA.csv", sep=",")
